﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;

namespace WindowsGame4
{
    class Bomb_ActivateState : State
    {
        private static Bomb_ActivateState instance;

        private Bomb_ActivateState()
        {
            base.Name = "ActivateState";
        }

        public override void enter(AIObject aiObject)
        {
            AIBomb aiBomb = (AIBomb)aiObject;
            Bomb bomb = (Bomb)aiBomb.Bomb;
            EventEmitter.getInstance().registerMessage(20000000, aiBomb.Id, aiBomb.Id, Message.MessageType.msg_destroy);
            if (Game1.enableMusic)
                Game1.timeBombSound.Play();        
        }

        public static Bomb_ActivateState getInstance()
        {
            if (instance == null)
                instance = new Bomb_ActivateState();
            return instance;
        }

        public override void execute(AIObject aiObject)
        {
        }

        public override void exit(AIObject aiObject)
        {

        }

        public override Boolean onMessage(AIObject aiObject, Message message)
        {
            Boolean correct = false;
            switch (message.Type)
            {
                case Message.MessageType.msg_destroy:
                    {
                        aiObject.StateMachine.changeState(Bomb_DestroyState.getInstance());
                        correct = true;
                        break;
                    }
            }
            return correct;
        }
    }
}
